<#include "common/common.html"/>
<meta charset="UTF-8">
<table
	     class="easyui-datagrid"   
	     id="datagrid"  
         title="数据字典"  
         url="${base}/dictionary/list"
         toolbar="#searchtool,#toolbar" 
         pagination="true"
         rownumbers="true" 
         fitColumns="true"
         singleSelect="true"
         data-options="fit:false,border:false,pageSize:20,pageList:[5,10,15,20]" >  
    <thead>  
        <tr>
            <th field="id" width="5%" checkbox="true"></th>  
            <th field="itemName" width="20%">名称</th>  
            <th field="itemCode" width="20%">编码</th>
            <th field="parentItem" width="20%">上级元素</th>  
            <th field="status" formatter="formatStatus" width="20%">状态</th>  
            <th field="weight"  width="15%">排序</th>   
        </tr>  
    </thead>  
</table>  
<div id="searchtool" style="padding:5px">  
      <span>名&nbsp;&nbsp;称:</span><input type="text" id="name" value="" size=10 />  
      <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-search" onclick="javascript:queryData({itemName:$('#name').val()});">搜索</a>  
<div>  
<div id="toolbar">
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="javascript:openNewDlg('添加','dictionary/save','dictionary-dlg','dictionary-fm');">添加</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="javascript:openEditDlg('修改','dictionary/edit','dictionary-dlg','dictionary-fm');">修改</a>
</div>
<div id="dictionary-dlg" class="easyui-dialog"  style="padding:10px 20px" closed="true" modal="true" buttons="#dlg-buttons">
        <form id="dictionary-fm" method="post">
            <div class="fitem">
               <label>名称:</label>
               <input class="easyui-textbox" name="itemName" id="itemName" required="true" validType="notemptyorblank">
	        </div>
            <div class="fitem">
                <label>编码:</label>
                <input name="itemCode" id="itemCode" class="easyui-textbox" required="true" data-options="validType:['integer']">
            </div>
            <div class="fitem">
                <label>上级元素:</label>
                <input name="topItemCode" id="topItemCode" class="easyui-combobox" required="true" data-options="valueField:'itemCode',textField:'itemName',panelHeight:'auto',editable:false,url:'${base}/dictionary/initFirstLevelItem'">
            </div>
            <div class="fitem">
                <label>状态:</label>
                <select class="easyui-combobox" editable="false" name="status" id="status" style="width:165px;" required="true">
				   <option value="1" selected="selected">有效</option>
	               <option value="0">无效</option>
                </select>
           </div>
             <div class="fitem">
                <label>排序:</label>
                <input name="weight" id="weight" class="easyui-textbox" required="true" data-options="validType:['integer']">
            </div>
        </form>
</div>
<div id="dlg-buttons">
    <a href="javascript:void(0)" id="saveBtn" class="easyui-linkbutton c6" iconCls="icon-ok" onclick="javascript:submit('dictionary-dlg','dictionary-fm')" style="width:90px">提交</a>
    <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dictionary-dlg').dialog('close')" style="width:90px">取消</a>
</div>
<script type="text/javascript">
function formatStatus(val){
	if (val == 1){
		return '有效';
	} else {
		return '无效';
	}
}
</script>

